package com.yuneec.droneservice.parse;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * This class is used for transmitting bind state.
 *
 * @author zd.zhang
 * @version 1.0
 */
public class BindState implements Parcelable {
    /**
     * {@value} means not bound.
     */
    public static final int NOT_BOUND = 0;
    /**
     * {@value} means bound.
     */
    public static final int BOUND = 1;
    /**
     * Current bind state.
     */
    public int state = NOT_BOUND;

    public BindState(Parcel in) {
        state = in.readInt();
    }

    public BindState() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(state);
    }

    public void readFromParcel(Parcel in) {
        state = in.readInt();
    }

    public static final Creator<BindState> CREATOR = new Creator<BindState>() {
        @Override
        public BindState createFromParcel(Parcel in) {
            return new BindState(in);
        }

        @Override
        public BindState[] newArray(int size) {
            return new BindState[size];
        }
    };
}
